package net.hualisheng.netty.service;

import net.hualisheng.netty.mapper.RedpackMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RedEnvelopeServiceImpl implements RedEnvelopeService {
    @Autowired
    private RedpackMapper redpackMapper;
    /**
     * 查看红包总数
     *
     * @param id
     * @return
     */
    @Override
    public int getRedEnvelopeCount(Integer id) {
        int remain = redpackMapper.selectRemainByPrimaryKey(id);
        return remain;
    }

    /**
     * 扣减红包个数
     *
     * @param id
     * @return
     */
    @Override
    public int reduceRedEnvelope(Integer id) {
        int i = redpackMapper.updateRemainRedPack(id);
        return i;
    }
}
